using UnityEngine;
using System.Collections;

public class Parallax : MonoBehaviour 
{
	private float parallaxOffset;
	public float speed;
	private float originalSpeed;
	
	void Start () 
	{
		this.originalSpeed = speed;
	}
	
	void Update () 
	{
		
	}
	
	public void SetParallax(ParallaxMode parallaxMode)
	{
		switch(parallaxMode)
		{
			case ParallaxMode.Normal:
				parallaxOffset -= speed;
				break;
				
			case ParallaxMode.Boost:
				parallaxOffset -= speed * 3;
				break;
			
			case ParallaxMode.Dying:
				parallaxOffset -= speed;
				break;
			
		case ParallaxMode.Break:

				
			break;
				
			default:
			
				break;
		}

        renderer.material.mainTextureOffset = new Vector2(parallaxOffset * speed, 0);
	}	
	
	public void Reset()
	{
		this.speed = originalSpeed;
	}
}


public enum ParallaxMode
{
	Normal, Boost, Break, Dying
}
